<?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="net.northking.cctp.device.db.dao.CdDeviceProjectDao">

  <delete id="recycleDevice">
    DELETE FROM
    <include refid="Table_Name"/>
    WHERE now() > expired_time
    and recycle_type = '1'
  </delete>
  <!-- 请在本文件内添加自定义SQL语句 -->

  <select id="findProByType" resultType="string">
    SELECT cdp.id
    FROM cd_device_project cdp
    LEFT JOIN cd_device_status cds ON cdp.id = cds.id
    WHERE cds.device_type = '2'
    AND cds.device_status = '1'
    <if test="projectId != null">
      AND cdp.project_id=#{projectId,jdbcType=VARCHAR}
    </if>
  </select>

</mapper>