<?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.xisc.pm.infra.mapper.PmSlabMethodMapper">


    <sql id = "BaseSql">
    PSM.PROD_LINE_STATS_ID,
    PSM.PROD_LINE_ID,
    PSM.COMBO_SLAB_METHOD,
    PSM.PRIORITY,
    PSM.TENANT_ID,
    PSM.ATTRIBUTE1,
    PSM.ATTRIBUTE2,
    PSM.ATTRIBUTE3,
    PSM.ATTRIBUTE4,
    PSM.ATTRIBUTE5,
    PSM.creation_date,    PSM.created_by,    PSM.last_updated_by,    PSM.last_update_date,    PSM.object_version_number
    </sql>

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.PmSlabMethod">
        select
        <include refid = "BaseSql"/>
        from PM_SLAB_METHOD PSM
        <where>
            <if test="prodLineStatsId !=null">
                and PSM.PROD_LINE_STATS_ID = #{prodLineStatsId,jdbcType = INTEGER}
            </if>
        </where>
    </select>

    <select id="selectByProdLineIdList" resultType="com.xisc.pm.api.dto.PmSlabMethodDTO">
        select t.prod_line_stats_id,
        t.prod_line_id,
        t.combo_slab_method,
        t.priority,
        t.tenant_id,
        t.object_version_number,
        t.creation_date,
        t.created_by,
        t.last_updated_by,
        t.last_update_date,
        t.attribute1,
        t.attribute2,
        t.attribute3,
        t.attribute4,
        t.attribute5
        from PM_SLAB_METHOD t
        where 1=1
        <if test="tenantId !=null">
            and t.tenant_id = #{tenantId}
        </if>
        <if test="prodLineId !=null">
            and t.prod_line_id = #{prodLineId}
        </if>
    </select>
</mapper>

