zhaiyifei 10 месяцев назад
Родитель
Сommit
4a298a3e66

+ 15 - 3
src/main/java/com/yunfeiyun/agmp/iotm/web/controller/IotDeviceBindController.java

@@ -1,13 +1,16 @@
 package com.yunfeiyun.agmp.iotm.web.controller;
 
+import com.yunfeiyun.agmp.common.annotation.Log;
 import com.yunfeiyun.agmp.common.core.controller.BaseController;
 import com.yunfeiyun.agmp.common.core.domain.AjaxResult;
 import com.yunfeiyun.agmp.common.core.page.TableDataInfo;
+import com.yunfeiyun.agmp.common.enums.BusinessType;
 import com.yunfeiyun.agmp.common.utils.StringUtils;
 import com.yunfeiyun.agmp.iotm.web.domain.IotDeviceBindBlockVo;
 import com.yunfeiyun.agmp.iotm.web.domain.IotDeviceBindLandVo;
 import com.yunfeiyun.agmp.iotm.web.domain.IotDeviceBindStatisticVo;
 import com.yunfeiyun.agmp.iotm.web.domain.IotDeviceBindVo;
+import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceBindAddReqVo;
 import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceBindListReqVo;
 import com.yunfeiyun.agmp.iotm.web.domain.resvo.FmsBlockListByDeviceBindResVo;
 import com.yunfeiyun.agmp.iotm.web.domain.resvo.FmsLandListByDeviceBindResVo;
@@ -18,9 +21,8 @@ import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceBindService;
 import com.yunfeiyun.agmp.iotm.web.service.ITosDevicetypeService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -209,4 +211,14 @@ public class IotDeviceBindController extends BaseController {
         return success(responseInfo);
     }
 
+    /**
+     * 设备绑定基地地块
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Log(title = "设备绑定基地地块", businessType = BusinessType.INSERT)
+    @PostMapping("/bind")
+    public AjaxResult bind(@RequestBody IotDeviceBindAddReqVo reqVo) {
+        return toAjax(iIotDeviceBindService.iotDeviceBindAdd(reqVo));
+    }
+
 }

+ 29 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/domain/reqvo/IotDeviceBindAddReqVo.java

@@ -0,0 +1,29 @@
+package com.yunfeiyun.agmp.iotm.web.domain.reqvo;
+
+import com.yunfeiyun.agmp.common.annotation.Excel;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * 设备基础对象 IotDevice
+ * 
+ * @author 杨晓辉
+ * @date 2024-01-04
+ */
+@Data
+public class IotDeviceBindAddReqVo
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 设备唯一标识 */
+    @Excel(name = "设备列表标识")
+    @NotNull(message = "设备列表标识不能为空")
+    private List<String> devBidList;
+
+    @NotNull(message = "基地标识不能为空")
+    private String landId;
+
+    private String blockId;
+}

+ 41 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/mapper/TmnBlockMapper.java

@@ -0,0 +1,41 @@
+package com.yunfeiyun.agmp.iotm.web.mapper;
+
+import com.yunfeiyun.agmp.iot.common.domain.TmnBlock;
+
+import java.util.List;
+
+/**
+ * 设备地块Mapper接口
+ *
+ * @author 杨晓辉
+ * @date 2023-07-12
+ */
+public interface TmnBlockMapper {
+
+    public List<TmnBlock> selectTmnBlockList(TmnBlock tmnBlock);
+
+    /**
+     * 绑定设备到地块
+     *
+     * @param tmnBlock
+     * @return 结果
+     */
+    public int insertTmnBlockBatch(List<TmnBlock> tmnBlock);
+
+//    /**
+//     * 根据地块查询各个地块设备数量
+//     * @return
+//     */
+//    public List<Map<String, Object>> selectCountByBlockId();
+//
+
+//
+//    public int deleteTmnBlockByTmnblockId(String tmnblockId);
+//
+//    public int deleteTmnBlockByBlockIdsAndDevBid(IotDeviceBindBlockDelVo iotDeviceBindBlockDelVo);
+//
+//
+//
+//
+//    List<TmnBlock> selectTmnBlockByBlockIdsAndDevType(@Param("blockIds") List<String> blockIds,@Param("devTypeBid") String devTypeBid);
+}

+ 37 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/mapper/TmnLandMapper.java

@@ -0,0 +1,37 @@
+package com.yunfeiyun.agmp.iotm.web.mapper;
+
+import com.yunfeiyun.agmp.iot.common.domain.TmnLand;
+
+import java.util.List;
+
+/**
+ * 设备基地Mapper接口
+ * 
+ * @author 杨晓辉
+ * @date 2023-07-12
+ */
+public interface TmnLandMapper 
+{
+    public List<TmnLand> selectTmnLandList(TmnLand tmnLand);
+
+    /**
+     * 绑定设备到基地
+     *
+     * @param tmnLand 设备基地
+     * @return 结果
+     */
+    public int insertTmnLandBatch(List<TmnLand> tmnLand);
+
+//    /**
+//     * 根据基地统计各个基地的设备数量
+//     * @return
+//     */
+//    public List<Map<String, Object>> selectCountByLandId();
+//
+
+//
+//    public int deleteTmnLandByTmnlandId(String tmnlandId);
+
+
+
+}

+ 8 - 7
src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotDeviceBindService.java

@@ -2,6 +2,7 @@ package com.yunfeiyun.agmp.iotm.web.service;
 
 import com.yunfeiyun.agmp.iotm.web.domain.IotDeviceBindStatisticVo;
 import com.yunfeiyun.agmp.iotm.web.domain.IotDeviceBindVo;
+import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceBindAddReqVo;
 import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceBindListReqVo;
 
 import java.util.List;
@@ -18,13 +19,13 @@ public interface IIotDeviceBindService {
     public List<IotDeviceBindVo> selectIotDeviceBindDetailList(IotDeviceBindListReqVo iotDeviceBindListReqVo);
 
     public List<IotDeviceBindStatisticVo> selectDeviceBindStatistic();
-//
-//    /**
-//     * 绑定设备到基地或地块
-//     *
-//     * @return
-//     */
-//    public int iotDeviceBindAdd(IotDeviceBindAddReqVo iotDeviceBindAddReqVo);
+
+    /**
+     * 绑定设备到基地或地块
+     *
+     * @return
+     */
+    public int iotDeviceBindAdd(IotDeviceBindAddReqVo iotDeviceBindAddReqVo);
 //
 //    public int iotDeviceBindDel(IotDeviceBindDelReqVo iotDeviceBindDelReqVo);
 //

+ 33 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/ITmnBlockService.java

@@ -0,0 +1,33 @@
+package com.yunfeiyun.agmp.iotm.web.service;
+
+import com.yunfeiyun.agmp.iot.common.domain.TmnBlock;
+
+import java.util.List;
+
+/**
+ * 设备地块Service接口
+ *
+ * @author 杨晓辉
+ * @date 2023-07-12
+ */
+public interface ITmnBlockService {
+
+    public List<TmnBlock> selectTmnBlockList(TmnBlock tmnBlock);
+
+    public List<TmnBlock> selectTmnBlockByBlockId(String blockId);
+
+    public int insertTmnBlockBatch(List<TmnBlock> tmnBlock);
+
+//    /**
+//     * 根据地块查询各个地块设备数量
+//     * @return
+//     */
+//    public List<Map<String, Object>> selectCountByBlockId();
+//
+
+//
+//    public int deleteTmnBlockByTmnblockId(String tmnblockId);
+//
+//    public int deleteTmnBlockByBlockIdsAndDevBid(IotDeviceBindBlockDelVo iotDeviceBindBlockDelVo);
+
+}

+ 41 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/ITmnLandService.java

@@ -0,0 +1,41 @@
+package com.yunfeiyun.agmp.iotm.web.service;
+
+
+import com.yunfeiyun.agmp.iot.common.domain.TmnLand;
+
+import java.util.List;
+
+/**
+ * 设备基地Service接口
+ * 
+ * @author 杨晓辉
+ * @date 2023-07-12
+ */
+public interface ITmnLandService 
+{
+
+    public List<TmnLand> selectTmnLandList(TmnLand tmnLand);
+
+    public List<TmnLand> selectTmnLandByLandId(String landId);
+
+    /**
+     * 绑定设备到基地
+     *
+     * @param tmnLand 设备基地
+     * @return 结果
+     */
+    public int insertTmnLandBatch(List<TmnLand> tmnLand);
+
+//    /**
+//     * 根据基地统计各个基地的设备数量
+//     * @return
+//     */
+//    public List<Map<String, Object>> selectCountByLandId();
+//
+
+//
+//    public int deleteTmnLandByTmnlandId(String tmnlandId);
+
+
+
+}

+ 80 - 66
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotDeviceBindServiceImpl.java

@@ -1,15 +1,26 @@
 package com.yunfeiyun.agmp.iotm.web.service.impl;
 
+import com.yunfeiyun.agmp.common.utils.DateUtils;
 import com.yunfeiyun.agmp.common.utils.SecurityUtils;
+import com.yunfeiyun.agmp.common.utils.StringUtils;
+import com.yunfeiyun.agmp.iot.common.constant.IotErrorCode;
+import com.yunfeiyun.agmp.iot.common.domain.TmnBlock;
+import com.yunfeiyun.agmp.iot.common.domain.TmnLand;
+import com.yunfeiyun.agmp.iot.common.exception.IotBizException;
 import com.yunfeiyun.agmp.iotm.web.domain.IotDeviceBindStatisticVo;
 import com.yunfeiyun.agmp.iotm.web.domain.IotDeviceBindVo;
+import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceBindAddReqVo;
 import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceBindListReqVo;
 import com.yunfeiyun.agmp.iotm.web.mapper.IotDeviceBindMapper;
 import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceBindService;
+import com.yunfeiyun.agmp.iotm.web.service.ITmnBlockService;
+import com.yunfeiyun.agmp.iotm.web.service.ITmnLandService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
 
 @Slf4j
@@ -19,11 +30,12 @@ public class IotDeviceBindServiceImpl implements IIotDeviceBindService {
     @Autowired
     private IotDeviceBindMapper iotDeviceBindMapper;
 
-//    @Autowired
-//    private ITmnLandService iTmnLandService;
-//
-//    @Autowired
-//    private ITmnBlockService iTmnBlockService;
+    @Autowired
+    private ITmnLandService iTmnLandService;
+
+    @Autowired
+    private ITmnBlockService iTmnBlockService;
+
 //    @Autowired
 //    private FmsBlockMapper fmsBlockMapper;
     /**
@@ -57,67 +69,69 @@ public class IotDeviceBindServiceImpl implements IIotDeviceBindService {
         String tid = SecurityUtils.getTid();
         return iotDeviceBindMapper.selectDeviceBindStatistic(tid);
     }
-//
-//    /**
-//     * 绑定设备到基地或地块
-//     *
-//     * @param iotDeviceBindAddReqVo
-//     * @return
-//     */
-//    @Override
-//    public int iotDeviceBindAdd(IotDeviceBindAddReqVo iotDeviceBindAddReqVo) {
-//        List<String> devBidList = iotDeviceBindAddReqVo.getDevBidList();
-//        String landId = iotDeviceBindAddReqVo.getLandId();
-//        String blockId = iotDeviceBindAddReqVo.getBlockId();
-//        HashSet<String> tmnIdLandSet = new HashSet<>();
-//        List<TmnLand> tmnLandResultList = iTmnLandService.selectTmnLandByLandId(landId);
-//        if(tmnLandResultList != null){
-//            for(TmnLand tmn: tmnLandResultList){
-//                tmnIdLandSet.add(tmn.getTmnId());
-//            }
-//        }
-//
-//        HashSet<String> tmnIdBlockSet = new HashSet<>();
-//        List<TmnBlock> tmnBlockResultList = iTmnBlockService.selectTmnBlockByBlockId(blockId);
-//        if(tmnBlockResultList != null){
-//            for(TmnBlock tmnB: tmnBlockResultList){
-//                tmnIdBlockSet.add(tmnB.getTmnId());
-//            }
-//        }
-//
-//        List<TmnLand> tmnLandList = new ArrayList<>();
-//        List<TmnBlock> tmnBlockList = new ArrayList<>();
-//        for(String devBid: devBidList){
-//            if(!tmnIdLandSet.contains(devBid)){
-//                TmnLand tmnLand = new TmnLand();
-//                tmnLand.setTmnlandId(tmnLand.getId());
-//                tmnLand.setTmnId(devBid);
-//                tmnLand.setLandId(landId);
-//                tmnLand.setTmnlandAssigndate(DateUtils.dateTimeNow());
-//                tmnLandList.add(tmnLand);
-//            }
-//
-//            if(StringUtils.isNotEmpty(blockId) && !tmnIdBlockSet.contains(devBid)){
-//                TmnBlock tmnBlock = new TmnBlock();
-//                tmnBlock.setTmnblockId(tmnBlock.getId());
-//                tmnBlock.setTmnId(devBid);
-//                tmnBlock.setBlockId(blockId);
-//                tmnBlock.setTmnblockAssigndate(DateUtils.dateTimeNow());
-//                tmnBlockList.add(tmnBlock);
-//            }
-//        }
-//        int status = 0;
-//        if(tmnLandList.size() > 0){
-//            status = iTmnLandService.insertTmnLandBatch(tmnLandList);
-//        }
-//        if(tmnBlockList.size() > 0){
-//            status = iTmnBlockService.insertTmnBlockBatch(tmnBlockList);
-//        }
-//        if(status == 0){
-//            throw new IotBizException(IotErrorCode.BIND_DEVICE_EXIST);
-//        }
-//        return status;
-//    }
+
+    /**
+     * 绑定设备到基地或地块
+     *
+     * @param iotDeviceBindAddReqVo
+     * @return
+     */
+    @Override
+    public int iotDeviceBindAdd(IotDeviceBindAddReqVo iotDeviceBindAddReqVo) {
+        List<String> devBidList = iotDeviceBindAddReqVo.getDevBidList();
+        String landId = iotDeviceBindAddReqVo.getLandId();
+        String blockId = iotDeviceBindAddReqVo.getBlockId();
+        HashSet<String> tmnIdLandSet = new HashSet<>();
+        List<TmnLand> tmnLandResultList = iTmnLandService.selectTmnLandByLandId(landId);
+        if(tmnLandResultList != null){
+            for(TmnLand tmn: tmnLandResultList){
+                tmnIdLandSet.add(tmn.getTmnId());
+            }
+        }
+
+        HashSet<String> tmnIdBlockSet = new HashSet<>();
+        List<TmnBlock> tmnBlockResultList = iTmnBlockService.selectTmnBlockByBlockId(blockId);
+        if(tmnBlockResultList != null){
+            for(TmnBlock tmnB: tmnBlockResultList){
+                tmnIdBlockSet.add(tmnB.getTmnId());
+            }
+        }
+
+        List<TmnLand> tmnLandList = new ArrayList<>();
+        List<TmnBlock> tmnBlockList = new ArrayList<>();
+
+        for(String devBid: devBidList){
+            if(!tmnIdLandSet.contains(devBid)){
+                TmnLand tmnLand = new TmnLand();
+                tmnLand.setTmnlandId(tmnLand.getUUId());
+                tmnLand.setTmnId(devBid);
+                tmnLand.setLandId(landId);
+                tmnLand.setTmnlandAssigndate(DateUtils.dateTimeNow());
+                tmnLandList.add(tmnLand);
+            }
+
+            if(StringUtils.isNotEmpty(blockId) && !tmnIdBlockSet.contains(devBid)){
+                TmnBlock tmnBlock = new TmnBlock();
+                tmnBlock.setTmnblockId(tmnBlock.getUUId());
+                tmnBlock.setTmnId(devBid);
+                tmnBlock.setBlockId(blockId);
+                tmnBlock.setTmnblockAssigndate(DateUtils.dateTimeNow());
+                tmnBlockList.add(tmnBlock);
+            }
+        }
+        int status = 0;
+        if(!tmnLandList.isEmpty()){
+            status = iTmnLandService.insertTmnLandBatch(tmnLandList);
+        }
+        if(!tmnBlockList.isEmpty()){
+            status = iTmnBlockService.insertTmnBlockBatch(tmnBlockList);
+        }
+        if(status == 0){
+            throw new IotBizException(IotErrorCode.BIND_DEVICE_EXIST.getCode(), "设备已绑定");
+        }
+        return status;
+    }
+
 //
 //    /**
 //     * @param iotDeviceBindDelReqVo

+ 72 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/TmnBlockServiceImpl.java

@@ -0,0 +1,72 @@
+package com.yunfeiyun.agmp.iotm.web.service.impl;
+
+import com.yunfeiyun.agmp.common.utils.SecurityUtils;
+import com.yunfeiyun.agmp.iot.common.domain.TmnBlock;
+import com.yunfeiyun.agmp.iotm.web.mapper.TmnBlockMapper;
+import com.yunfeiyun.agmp.iotm.web.service.ITmnBlockService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 设备地块Service业务层处理
+ *
+ * @author 杨晓辉
+ * @date 2023-07-12
+ */
+@Service
+public class TmnBlockServiceImpl implements ITmnBlockService {
+    @Autowired
+    private TmnBlockMapper tmnBlockMapper;
+
+    @Override
+    public List<TmnBlock> selectTmnBlockList(TmnBlock tmnBlock) {
+        tmnBlock.setTid(SecurityUtils.getTid());
+        return tmnBlockMapper.selectTmnBlockList(tmnBlock);
+    }
+
+    /**
+     * @param blockId
+     * @return
+     */
+    @Override
+    public List<TmnBlock> selectTmnBlockByBlockId(String blockId) {
+        TmnBlock tmnBlock = new TmnBlock();
+        tmnBlock.setBlockId(blockId);
+        return selectTmnBlockList(tmnBlock);
+    }
+
+    public int insertTmnBlockBatch(List<TmnBlock> tmnBlock){
+        for (TmnBlock t : tmnBlock) {
+            t.setTid(SecurityUtils.getTid());
+        }
+        return tmnBlockMapper.insertTmnBlockBatch(tmnBlock);
+    }
+
+//
+//    @Override
+//    public List<Map<String, Object>> selectCountByBlockId() {
+//        return tmnBlockMapper.selectCountByBlockId();
+//    }
+//
+
+//
+//    /**
+//     * @param tmnblockId
+//     * @return
+//     */
+//    @Override
+//    public int deleteTmnBlockByTmnblockId(String tmnblockId) {
+//        return tmnBlockMapper.deleteTmnBlockByTmnblockId(tmnblockId);
+//    }
+//
+//    /**
+//     * @param iotDeviceBindBlockDelVo
+//     * @return
+//     */
+//    @Override
+//    public int deleteTmnBlockByBlockIdsAndDevBid(IotDeviceBindBlockDelVo iotDeviceBindBlockDelVo) {
+//        return tmnBlockMapper.deleteTmnBlockByBlockIdsAndDevBid(iotDeviceBindBlockDelVo);
+//    }
+}

+ 74 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/TmnLandServiceImpl.java

@@ -0,0 +1,74 @@
+package com.yunfeiyun.agmp.iotm.web.service.impl;
+
+import com.yunfeiyun.agmp.common.utils.SecurityUtils;
+import com.yunfeiyun.agmp.iot.common.domain.TmnLand;
+import com.yunfeiyun.agmp.iotm.web.mapper.TmnLandMapper;
+import com.yunfeiyun.agmp.iotm.web.service.ITmnLandService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+
+/**
+ * 设备基地Service业务层处理
+ * 
+ * @author 杨晓辉
+ * @date 2023-07-12
+ */
+@Service
+public class TmnLandServiceImpl implements ITmnLandService
+{
+    @Autowired
+    private TmnLandMapper tmnLandMapper;
+
+    @Override
+    public List<TmnLand> selectTmnLandList(TmnLand tmnLand) {
+        tmnLand.setTid(SecurityUtils.getTid());
+        return tmnLandMapper.selectTmnLandList(tmnLand);
+    }
+
+    /**
+     * @param landId
+     * @return
+     */
+    @Override
+    public List<TmnLand> selectTmnLandByLandId(String landId) {
+        TmnLand tmnLand = new TmnLand();
+        tmnLand.setLandId(landId);
+        return selectTmnLandList(tmnLand);
+    }
+
+    /**
+     * 绑定设备到基地
+     *
+     * @param tmnLand 设备基地
+     * @return 结果
+     */
+    @Override
+    public int insertTmnLandBatch(List<TmnLand> tmnLand) {
+        for(TmnLand t:tmnLand) {
+            t.setTid(SecurityUtils.getTid());
+        }
+        return tmnLandMapper.insertTmnLandBatch(tmnLand);
+    }
+
+//
+//    @Override
+//    public List<Map<String, Object>> selectCountByLandId() {
+//        return tmnLandMapper.selectCountByLandId();
+//    }
+//
+
+//
+//    /**
+//     * @param tmnlandId
+//     * @return
+//     */
+//    @Override
+//    public int deleteTmnLandByTmnlandId(String tmnlandId) {
+//        return tmnLandMapper.deleteTmnLandByTmnlandId(tmnlandId);
+//    }
+
+
+}

+ 79 - 0
src/main/resources/mapper/TmnBlockMapper.xml

@@ -0,0 +1,79 @@
+<?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.TmnBlockMapper">
+    
+    <resultMap type="TmnBlock" id="TmnBlockResult">
+        <result property="tmnblockId"    column="tmnblockId"    />
+        <result property="tmnId"    column="tmnId"    />
+        <result property="blockId"    column="blockId"    />
+        <result property="tmnblockAssigndate"    column="tmnblockAssigndate"    />
+        <result property="tid"    column="tid"    />
+    </resultMap>
+
+    <select id="selectTmnBlockList" parameterType="TmnBlock" resultType="TmnBlock">
+        SELECT *
+        FROM TmnBlock as t
+        WHERE t.blockId = #{blockId} and t.tid = #{tid}
+    </select>
+
+    <insert id="insertTmnBlockBatch" parameterType="TmnBlock">
+        <foreach collection="list" item="item" separator=";">
+            insert into TmnBlock
+            <trim prefix="(" suffix=")" suffixOverrides=",">
+                <if test="item.tid != null">tid,</if>
+                <if test="item.tmnblockId != null">tmnblockId,</if>
+                <if test="item.tmnId != null">tmnId,</if>
+                <if test="item.blockId != null">blockId,</if>
+                <if test="item.tmnblockAssigndate != null">tmnblockAssigndate,</if>
+            </trim>
+            <trim prefix="values (" suffix=")" suffixOverrides=",">
+                <if test="item.tid != null">#{item.tid},</if>
+                <if test="item.tmnblockId != null">#{item.tmnblockId},</if>
+                <if test="item.tmnId != null">#{item.tmnId},</if>
+                <if test="item.blockId != null">#{item.blockId},</if>
+                <if test="item.tmnblockAssigndate != null">#{item.tmnblockAssigndate},</if>
+            </trim>
+        </foreach>
+    </insert>
+
+<!--    <select id="selectCountByBlockId" parameterType="String" resultType="map">-->
+<!--        SELECT count(tmnId) count, blockId-->
+<!--        FROM TmnBlock-->
+<!--        GROUP BY blockId-->
+<!--    </select>-->
+
+
+
+<!--    <delete id="deleteTmnBlockByTmnblockId" parameterType="String">-->
+<!--        delete from TmnBlock where tmnblockId = #{tmnblockId}-->
+<!--    </delete>-->
+
+<!--    <delete id="deleteTmnBlockByBlockIdsAndDevBid" parameterType="IotDeviceBindBlockDelVo">-->
+<!--        delete from TmnBlock where tmnId = #{tmnId} and blockId in-->
+<!--        <foreach collection="blockIdList" item="item" open="(" separator="," close=")">-->
+<!--            #{item}-->
+<!--        </foreach>-->
+<!--    </delete>-->
+
+
+<!--    <select id="selectTmnBlockByBlockIdsAndDevType" resultType="com.yunfeiyun.agmp.iot.common.domain.TmnBlock">-->
+<!--        SELECT t.*-->
+<!--        FROM TmnBlock as t-->
+<!--        LEFT JOIN IotDevice as d on t.tmnId = d.devBid-->
+<!--        <where>-->
+<!--            <if test="blockIds != null and blockIds.size() != 0">-->
+<!--                blockId in-->
+<!--                <foreach collection="blockIds" open="(" separator="," close=")" item="item">-->
+<!--                    #{item}-->
+<!--                </foreach>-->
+<!--            </if>-->
+<!--            <if test="devTypeBid != null and devTypeBid != ''">-->
+<!--                and d.devTypeBid = #{devTypeBid}-->
+<!--            </if>-->
+<!--        </where>-->
+
+
+<!--    </select>-->
+</mapper>

+ 54 - 0
src/main/resources/mapper/TmnLandMapper.xml

@@ -0,0 +1,54 @@
+<?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.TmnLandMapper">
+    
+    <resultMap type="TmnLand" id="TmnLandResult">
+        <result property="tmnlandId"    column="tmnlandId"    />
+        <result property="tmnId"    column="tmnId"    />
+        <result property="landId"    column="landId"    />
+        <result property="tmnlandAssigndate"    column="tmnlandAssigndate"    />
+        <result property="tid"    column="tid"    />
+    </resultMap>
+
+    <select id="selectTmnLandList" parameterType="TmnLand" resultType="TmnLand">
+        SELECT *
+        FROM TmnLand as t
+        WHERE t.landId = #{landId} and t.tid = #{tid}
+    </select>
+
+    <insert id="insertTmnLandBatch" parameterType="TmnLand">
+        <foreach collection="list" item="item" separator=";">
+            insert into TmnLand
+            <trim prefix="(" suffix=")" suffixOverrides=",">
+                <if test="item.tid != null">tid,</if>
+                <if test="item.tmnlandId != null">tmnlandId,</if>
+                <if test="item.tmnId != null">tmnId,</if>
+                <if test="item.landId != null">landId,</if>
+                <if test="item.tmnlandAssigndate != null">tmnlandAssigndate,</if>
+            </trim>
+            <trim prefix="values (" suffix=")" suffixOverrides=",">
+                <if test="item.tid != null">#{item.tid},</if>
+                <if test="item.tmnlandId != null">#{item.tmnlandId},</if>
+                <if test="item.tmnId != null">#{item.tmnId},</if>
+                <if test="item.landId != null">#{item.landId},</if>
+                <if test="item.tmnlandAssigndate != null">#{item.tmnlandAssigndate},</if>
+            </trim>
+        </foreach>
+    </insert>
+
+<!--    <select id="selectCountByLandId" parameterType="String" resultType="map">-->
+<!--        SELECT count(tmnId) count, landId-->
+<!--        FROM TmnLand-->
+<!--        GROUP BY landId-->
+<!--    </select>-->
+
+
+
+<!--    <delete id="deleteTmnLandByTmnlandId" parameterType="String">-->
+<!--        delete from TmnLand where tmnlandId = #{tmnlandId}-->
+<!--    </delete>-->
+
+
+</mapper>