|
|
@@ -0,0 +1,166 @@
|
|
|
+<?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.FmsBlockMapper">
|
|
|
+
|
|
|
+ <resultMap type="FmsBlock" id="FmsBlockResult">
|
|
|
+ <result property="blockId" column="blockId" />
|
|
|
+ <result property="landId" column="landId" />
|
|
|
+ <result property="blockName" column="blockName" />
|
|
|
+ <result property="blockType" column="blockType" />
|
|
|
+ <result property="blockManager" column="blockManager" />
|
|
|
+ <result property="blockManagername" column="blockManagername" />
|
|
|
+ <result property="blockArea" column="blockArea" />
|
|
|
+ <result property="blockAreaplant" column="blockAreaplant" />
|
|
|
+ <result property="blockLngrange" column="blockLngrange" />
|
|
|
+ <result property="blockColor" column="blockColor" />
|
|
|
+ <result property="blockRemark" column="blockRemark" />
|
|
|
+ <result property="blockPreview" column="blockPreview" />
|
|
|
+ <result property="blockSeq" column="blockSeq"/>
|
|
|
+ <result property="blockIcon" column="blockIcon"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="selectFmsBlockListByDeviceBind" resultType="FmsBlockListByDeviceBindResVo" parameterType="String">
|
|
|
+ SELECT fb.blockId, fb.blockName, IFNULL(f2.devNum, 0) AS devNum, fb.blockSeq
|
|
|
+ FROM FmsBlock AS fb
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT f.blockId, f.blockName, COUNT(*) AS devNum, f.blockSeq
|
|
|
+ FROM (
|
|
|
+ SELECT fb.blockId, fb.blockName, td.landId, fb.blockSeq
|
|
|
+ FROM FmsBlock AS fb
|
|
|
+ LEFT JOIN TmnBlock AS tb ON tb.blockId = fb.blockId
|
|
|
+ LEFT JOIN TmnLand AS td ON td.tmnId = tb.tmnId
|
|
|
+ LEFT JOIN IotDevice AS d ON d.devBid = tb.tmnId
|
|
|
+ WHERE fb.landId = #{landId} AND d.devDelstatus = '0' AND (td.landId IS NOT NULL)
|
|
|
+ GROUP BY fb.blockId, tb.tmnId
|
|
|
+ ) AS f
|
|
|
+ GROUP BY f.blockId
|
|
|
+ ) AS f2 ON fb.blockId = f2.blockId
|
|
|
+ WHERE fb.landId = #{landId}
|
|
|
+ ORDER BY fb.blockSeq
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+<!-- <sql id="selectFmsBlockVo">-->
|
|
|
+<!-- select blockId, landId, blockName, blockType, blockManager, blockManagername, blockArea, blockAreaplant,blockSeq,blockIcon,-->
|
|
|
+<!-- blockLngrange, blockColor, blockRemark from FmsBlock-->
|
|
|
+<!-- </sql>-->
|
|
|
+
|
|
|
+<!-- <select id="selectFmsBlockByBlockId" parameterType="String" resultMap="FmsBlockResult">-->
|
|
|
+<!-- <include refid="selectFmsBlockVo"/>-->
|
|
|
+<!-- where blockId = #{blockId}-->
|
|
|
+<!-- </select>-->
|
|
|
+
|
|
|
+<!-- <select id="selectFmsBlockBaseDataList" resultType="FmsBlock">-->
|
|
|
+<!-- <include refid="selectFmsBlockVo"/>-->
|
|
|
+<!-- <where>-->
|
|
|
+<!-- <if test="landId != null and landId != ''"> and landId = #{landId}</if>-->
|
|
|
+<!-- <if test="blockName != null and blockName != ''"> and blockName like concat('%', #{blockName}, '%')</if>-->
|
|
|
+<!-- <if test="blockNameEq != null and blockNameEq != ''"> and blockName = #{blockNameEq}</if>-->
|
|
|
+<!-- <if test="blockType != null and blockType != ''"> and blockType = #{blockType}</if>-->
|
|
|
+<!-- <if test="blockManager != null and blockManager != ''"> and blockManager = #{blockManager}</if>-->
|
|
|
+<!-- <if test="blockManagername != null and blockManagername != ''"> and blockManagername like concat('%', #{blockManagername}, '%')</if>-->
|
|
|
+<!-- <if test="blockArea != null "> and blockArea = #{blockArea}</if>-->
|
|
|
+<!-- <if test="blockAreaplant != null "> and blockAreaplant = #{blockAreaplant}</if>-->
|
|
|
+<!-- <if test="blockLngrange != null and blockLngrange != ''"> and blockLngrange = #{blockLngrange}</if>-->
|
|
|
+<!-- <if test="blockColor != null and blockColor != ''"> and blockColor = #{blockColor}</if>-->
|
|
|
+<!-- <if test="blockRemark != null and blockRemark != ''"> and blockRemark = #{blockRemark}</if>-->
|
|
|
+<!-- <if test="blockId != null and blockId != ''">-->
|
|
|
+<!-- and blockId = #{blockId}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="dataFilter == true and blockIds !=null and blockIds.size()>0">-->
|
|
|
+<!-- and b.blockId in-->
|
|
|
+<!-- <foreach collection="blockIds" item="blockId" index="index" open="(" close=")" separator=",">-->
|
|
|
+<!-- #{blockId}-->
|
|
|
+<!-- </foreach>-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="landIds != null and landIds.size()!=0">-->
|
|
|
+<!-- and landId in-->
|
|
|
+<!-- <foreach collection="landIds" item="item" index="index" open="(" separator="," close=")">-->
|
|
|
+<!-- #{item}-->
|
|
|
+<!-- </foreach>-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- </where>-->
|
|
|
+<!-- </select>-->
|
|
|
+<!-- -->
|
|
|
+
|
|
|
+
|
|
|
+<!-- <select id="selectFmsBlockListWithDevice" resultType="FmsBlockListWithDeviceResVo">-->
|
|
|
+<!-- SELECT FmsBlock.*-->
|
|
|
+<!-- ,FmsLand.landName-->
|
|
|
+<!-- ,IotDevice.devBid,IotDevice.devName,IotDevice.devStatus,IotDevice.devUpdateddate-->
|
|
|
+<!-- ,IotDevicetype.devtypePid,IotDevicetype.devtypeName-->
|
|
|
+<!-- ,(select GROUP_CONCAT(resUrl) from SysRes where SysRes.resBusId = FmsBlock.blockId) blockPreview-->
|
|
|
+<!-- ,SysUser.userMobile-->
|
|
|
+<!-- FROM FmsBlock-->
|
|
|
+
|
|
|
+<!-- left join TmnBlock on TmnBlock.blockId=FmsBlock.blockId-->
|
|
|
+<!-- left join IotDevice on IotDevice.devBid= TmnBlock.tmnId-->
|
|
|
+<!-- left join IotDevicetype on IotDevicetype.devtypeBid = IotDevice.devtypeBid-->
|
|
|
+<!-- left join FmsLand on FmsLand.landId = FmsBlock.landId-->
|
|
|
+<!-- left join SysUser on SysUser.userId = FmsBlock.blockManager-->
|
|
|
+
|
|
|
+<!-- <where>-->
|
|
|
+<!-- <if test="devtypePid != null and devtypePid != ''">and IotDevicetype.devtypePid = #{devtypePid}</if>-->
|
|
|
+<!-- <if test="landId != null and landId != ''">and FmsLand.landId = #{landId}</if>-->
|
|
|
+<!-- <if test="landName != null and landName != ''">and FmsLand.landName like concat('%', #{landName}, '%')</if>-->
|
|
|
+<!-- <if test="blockName != null and blockName != ''">and FmsBlock.blockName like concat('%', #{blockName}, '%')</if>-->
|
|
|
+<!-- <if test="blockManagername != null and blockManagername != ''">and FmsBlock.blockManagername like concat('%', #{blockManagername}, '%')</if>-->
|
|
|
+<!-- <if test="userMobile != null and userMobile != ''">and SysUser.userMobile like concat('%', #{userMobile}, '%')</if>-->
|
|
|
+<!-- <if test="blockId != null and blockId != ''">and FmsBlock.blockId = #{blockId}</if>-->
|
|
|
+<!-- <if test="devBid != null and devBid != ''">-->
|
|
|
+<!-- and IotDevice.devBid = #{devBid}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- </where>-->
|
|
|
+
|
|
|
+<!-- group by blockId-->
|
|
|
+<!-- </select>-->
|
|
|
+<!-- <select id="selectFmsBlockNum" resultType="java.lang.Integer">-->
|
|
|
+<!-- select count(1) from FmsBlock-->
|
|
|
+<!-- <where>-->
|
|
|
+<!-- <if test="landId != null and landId != ''">-->
|
|
|
+<!-- landId = #{landId}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- </where>-->
|
|
|
+<!-- </select>-->
|
|
|
+<!-- <select id="selectFmsBlockPlans" resultType="java.util.Map">-->
|
|
|
+<!-- select count(1) as plantNum,sum(planArea) as planAreaNum from FmsPlan where planStatus = '1'-->
|
|
|
+<!-- <where>-->
|
|
|
+<!-- <if test="landId != null and landId != ''">-->
|
|
|
+<!-- and landId = #{landId}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- </where>-->
|
|
|
+<!-- </select>-->
|
|
|
+<!-- <select id="selectFmsBlockList"-->
|
|
|
+<!-- resultType="com.yunfeiyun.agmp.iot.common.domain.FmsBlock">-->
|
|
|
+<!-- select * from FmsBlock where 1=1-->
|
|
|
+<!-- <if test="blockName != null and blockName != ''">-->
|
|
|
+<!-- and FmsBlock.blockName like concat('%', #{blockName}, '%')-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- order by blockSeq-->
|
|
|
+<!-- </select>-->
|
|
|
+<!-- <select id="selectFmsBlockListByLandId" resultType="com.yunfeiyun.agmp.iotm.device.domain.resvo.FmsBlockIrrigateResVo">-->
|
|
|
+<!-- SELECT-->
|
|
|
+<!-- fpp.resUrl as cropPreview,-->
|
|
|
+<!-- fb.*-->
|
|
|
+<!-- FROM-->
|
|
|
+<!-- FmsBlock fb-->
|
|
|
+<!-- LEFT JOIN (-->
|
|
|
+<!-- SELECT-->
|
|
|
+<!-- fp.blockId,-->
|
|
|
+<!-- sr.resUrl-->
|
|
|
+<!-- FROM-->
|
|
|
+<!-- FmsPlan fp-->
|
|
|
+<!-- LEFT JOIN FmsCrop fc ON fp.cropId = fc.cropId-->
|
|
|
+<!-- LEFT JOIN SysRes sr ON sr.resBusId = fc.cropId-->
|
|
|
+<!-- ) fpp ON fpp.blockId = fb.blockId-->
|
|
|
+<!-- <where>-->
|
|
|
+<!-- <if test="landId != null and landId != ''">-->
|
|
|
+<!-- and fb.landId = #{landId}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- </where>-->
|
|
|
+<!-- GROUP BY-->
|
|
|
+<!-- fb.blockId-->
|
|
|
+<!-- </select>-->
|
|
|
+</mapper>
|