IotPestMapper.xml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.yunfeiyun.agmp.iotm.web.mapper.IotPestMapper">
  6. <resultMap type="IotPest" id="IotPestResult">
  7. <result property="id" column="id"/>
  8. <result property="pestBid" column="pestBid"/>
  9. <result property="cId" column="cId"/>
  10. <result property="pestName" column="pestName"/>
  11. <result property="pestId" column="pestId"/>
  12. <result property="pestRemark" column="pestRemark"/>
  13. <result property="pestCreator" column="pestCreator"/>
  14. <result property="pestModifier" column="pestModifier"/>
  15. <result property="pestModifieddate" column="pestModifieddate"/>
  16. <result property="pestCreatedDate" column="pestCreatedDate"/>
  17. <result property="pestDelstatus" column="pestDelstatus"/>
  18. <result property="pestInsertType" column="pestInsertType"/>
  19. </resultMap>
  20. <sql id="selectIotPestVo">
  21. select id, pestBid, cId, pestName, pestId, pestRemark, pestCreator, pestModifier, pestModifieddate, pestCreatedDate, pestDelstatus, pestInsertType from IotPest
  22. </sql>
  23. <select id="selectIotPestList" parameterType="IotPest" resultMap="IotPestResult">
  24. <include refid="selectIotPestVo"/>
  25. <where>
  26. pestDelstatus = 0
  27. <if test="pestBid != null and pestBid != ''">and pestBid = #{pestBid}</if>
  28. <if test="cId != null and cId != ''">and cId = #{cId}</if>
  29. <if test="pestName != null and pestName != ''">and pestName like concat('%', #{pestName}, '%')</if>
  30. <if test="pestId != null and pestId != ''">and pestId = #{pestId}</if>
  31. <if test="pestInsertType != null and pestInsertType != ''">and pestInsertType = #{pestInsertType}</if>
  32. <if test="pestRemark != null and pestRemark != ''">and pestRemark like concat('%', #{pestRemark}, '%')</if>
  33. </where>
  34. </select>
  35. <select id="selectIotPestByPestBid" parameterType="String" resultMap="IotPestResult">
  36. <include refid="selectIotPestVo"/>
  37. where pestBid = #{pestBid}
  38. </select>
  39. <select id="selectIotPestByPestId" parameterType="String" resultMap="IotPestResult">
  40. <include refid="selectIotPestVo"/>
  41. where pestId = #{pestId}
  42. </select>
  43. <select id="selectIotPestListBatchByBid" parameterType="java.util.List" resultMap="IotPestResult">
  44. <include refid="selectIotPestVo"/>
  45. where pestDelstatus = '0' and pestBid in
  46. <foreach item="pestBid" collection="list" open="(" separator="," close=")">
  47. #{pestBid}
  48. </foreach>
  49. </select>
  50. <select id="selectIotPestDetailByPestBid"
  51. resultType="com.yunfeiyun.agmp.iot.common.domain.resvo.IoPestResVo">
  52. SELECT b.calarmCloudresurl pic , b.calamRemark ,CONCAT(b.calamFamilies,b.calamOrders) course ,b.calarmId from (
  53. SELECT * from IotPest where pestBid=#{pestBid}
  54. ) a LEFT JOIN FmsCalarm b on calarmName = a.pestName limit 0,1
  55. </select>
  56. <select id="selectIotPestCropsByCalarmId" resultType="java.lang.String">
  57. SELECT group_concat(cropName) crops from FmsCropcalarm where calarmId=#{calarmId} GROUP BY calarmId
  58. </select>
  59. <select id="selectIotPestByPestName" resultType="com.yunfeiyun.agmp.iot.common.domain.IotPest">
  60. <include refid="selectIotPestVo"/>
  61. <where>
  62. pestDelstatus = 0
  63. <if test="pestBid != null and pestBid != ''">and pestBid = #{pestBid}</if>
  64. <if test="cId != null and cId != ''">and cId = #{cId}</if>
  65. <if test="pestName != null and pestName != ''">and pestName like concat('%', #{pestName}, '%')</if>
  66. <if test="pestId != null and pestId != ''">and pestId = #{pestId}</if>
  67. <if test="pestRemark != null and pestRemark != ''">and pestRemark like concat('%', #{pestRemark}, '%')</if>
  68. </where>
  69. limit 1
  70. </select>
  71. <insert id="insertIotPest" parameterType="IotPest" useGeneratedKeys="true" keyProperty="id">
  72. insert into IotPest
  73. <trim prefix="(" suffix=")" suffixOverrides=",">
  74. <if test="pestBid != null and pestBid != ''">pestBid,</if>
  75. <if test="cId != null">cId,</if>
  76. <if test="pestName != null">pestName,</if>
  77. <if test="pestId != null">pestId,</if>
  78. <if test="pestRemark != null">pestRemark,</if>
  79. <if test="pestCreator != null">pestCreator,</if>
  80. <if test="pestModifier != null">pestModifier,</if>
  81. <if test="pestModifieddate != null">pestModifieddate,</if>
  82. <if test="pestCreatedDate != null">pestCreatedDate,</if>
  83. <if test="pestDelstatus != null">pestDelstatus,</if>
  84. <if test="pestInsertType != null">pestInsertType,</if>
  85. </trim>
  86. <trim prefix="values (" suffix=")" suffixOverrides=",">
  87. <if test="pestBid != null and pestBid != ''">#{pestBid},</if>
  88. <if test="cId != null">#{cId},</if>
  89. <if test="pestName != null">#{pestName},</if>
  90. <if test="pestId != null">#{pestId},</if>
  91. <if test="pestRemark != null">#{pestRemark},</if>
  92. <if test="pestCreator != null">#{pestCreator},</if>
  93. <if test="pestModifier != null">#{pestModifier},</if>
  94. <if test="pestModifieddate != null">#{pestModifieddate},</if>
  95. <if test="pestCreatedDate != null">#{pestCreatedDate},</if>
  96. <if test="pestDelstatus != null">#{pestDelstatus},</if>
  97. <if test="pestInsertType != null">#{pestInsertType},</if>
  98. </trim>
  99. </insert>
  100. <update id="updateIotPest" parameterType="IotPest">
  101. update IotPest
  102. <trim prefix="SET" suffixOverrides=",">
  103. <if test="pestBid != null and pestBid != ''">pestBid = #{pestBid},</if>
  104. <if test="cId != null">cId = #{cId},</if>
  105. <if test="pestName != null">pestName = #{pestName},</if>
  106. <if test="pestId != null">pestId = #{pestId},</if>
  107. <if test="pestRemark != null">pestRemark = #{pestRemark},</if>
  108. <if test="pestCreator != null">pestCreator = #{pestCreator},</if>
  109. <if test="pestModifier != null">pestModifier = #{pestModifier},</if>
  110. <if test="pestModifieddate != null">pestModifieddate = #{pestModifieddate},</if>
  111. <if test="pestCreatedDate != null">pestCreatedDate = #{pestCreatedDate},</if>
  112. <if test="pestDelstatus != null">pestDelstatus = #{pestDelstatus},</if>
  113. <if test="pestInsertType != null">pestInsertType = #{pestInsertType},</if>
  114. </trim>
  115. where id = #{id}
  116. </update>
  117. <delete id="deleteIotPestById" parameterType="Long">
  118. delete from IotPest where id = #{id}
  119. </delete>
  120. <delete id="deleteIotPestByIds" parameterType="String">
  121. delete from IotPest where id in
  122. <foreach item="id" collection="array" open="(" separator="," close=")">
  123. #{id}
  124. </foreach>
  125. </delete>
  126. </mapper>