<?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.yonge.cooleshow.biz.dal.dao.InstrumentDao">



    <!-- 表字段 -->
    <sql id="baseColumns">
         t.id_ AS id
        , t.subject_id_ AS subjectId
        , t.orientation_ AS orientation
        , t.del_flag_ AS delFlag
        , t.enable_flag_ AS enableFlag
        , t.create_time_ AS createTime
        , t.update_time_ AS updateTime
        , t.operator_ AS operator
        </sql>

    <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.InstrumentWrapper$Instrument">
		SELECT
        	<include refid="baseColumns" />
		FROM instrument t
        <where>
            <if test="param.subjectId != null">
                AND t.subject_id_ = #{param.subjectId}
            </if>
            <if test="param.subjectIds != null and param.subjectIds.size() != 0">
                AND t.subject_id_ in
                <foreach collection="param.subjectIds" item="item" separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="param.enableFlag != null">
                AND t.enable_flag_ = #{param.enableFlag}
            </if>
        </where>
	</select>

</mapper>
