shiyunteng
2025-04-02 7ed65656296a198162b91cdf311c197aebcff0e8
platformx-device-biz/src/main/resources/mapper/ReceivingNoteItemMapper.xml
@@ -35,5 +35,24 @@
      <if test="queryDTO.releaseCode != null and queryDTO.releaseCode !=''">
         and rn.release_code like CONCAT('%', #{queryDTO.releaseCode}, '%')
      </if>
      <if test="queryDTO.noteId != null and queryDTO.noteId !=''">
         and rni.note_id = #{queryDTO.noteId}
      </if>
   </select>
    <select id="selectDeviceNumByContractId" resultType="java.lang.Integer">
      select
         ifnull(sum(rni.num),0)
      from
         receiving_note_item rni
      where
         rni.device_id = #{deviceId}
        and exists (
            select
               *
            from
               receiving_note rn
            where
               rn.contract_id = #{contractId}
              and rn.id = rni.note_id)
   </select>
</mapper>