<?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.yida.data.device.consume.mapper.EduConsumeDeviceMapper">

	<select id="listDevicePage" resultType="com.yida.data.device.vo.consume.ConsumeDeviceVO">
		SELECT
			*
		FROM
			edu_consume_device
		WHERE
			del_flag = 0
		  AND school_id IN
		<foreach collection="schoolIds" open="(" close=")" separator="," item="schoolId">
			#{schoolId}
		</foreach>
		<if test='number != null and number != ""'>
		  AND ( sn LIKE CONCAT( '%', #{number}, '%' ) OR `name` LIKE CONCAT( '%', #{number}, '%' ) )
		</if>
		<if test="state != null">
			and state = #{state}
		</if>
		ORDER BY
			create_date DESC
	</select>
	
</mapper>
