<?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.brilliance.isc.mda.dao.LsbMapper">

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Lsb">
            <result property="inr" column="inr" jdbcType="CHAR"/>
            <result property="lsn" column="LSN" jdbcType="VARCHAR"/>
            <result property="lsntyp1" column="LSNTYP1" jdbcType="VARCHAR"/>
            <result property="lsninr1" column="lsninr1" jdbcType="CHAR"/>
            <result property="lsntyp2" column="LSNTYP2" jdbcType="VARCHAR"/>
            <result property="lsninr2" column="lsninr2" jdbcType="CHAR"/>
            <result property="lsntyp3" column="LSNTYP3" jdbcType="VARCHAR"/>
            <result property="lsninr3" column="lsninr3" jdbcType="CHAR"/>
            <result property="lsntyp4" column="LSNTYP4" jdbcType="VARCHAR"/>
            <result property="lsninr4" column="lsninr4" jdbcType="CHAR"/>
            <result property="cur" column="CUR" jdbcType="CHAR"/>
            <result property="amt" column="AMT" jdbcType="DECIMAL"/>
            <result property="lss" column="LSS" jdbcType="VARCHAR"/>
            <result property="expdat" column="EXPDAT" jdbcType="DATE"/>
            <result property="nonrevflg" column="NONREVFLG" jdbcType="CHAR"/>
            <result property="etgextkey" column="ETGEXTKEY" jdbcType="VARCHAR"/>
            <result property="ownref" column="OWNREF" jdbcType="VARCHAR"/>
            <result property="fentyp" column="FENTYP" jdbcType="VARCHAR"/>
            <result property="inftxt" column="INFTXT" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        inr,LSN,
        LSNTYP1,lsninr1,LSNTYP2,
        lsninr2,LSNTYP3,lsninr3,
        LSNTYP4,lsninr4,CUR,
        AMT,LSS,EXPDAT,
        NONREVFLG,ETGEXTKEY,OWNREF,
        FENTYP,INFTXT
    </sql>

    <select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.brilliance.isc.vo.lg.InflsbVo">
        select
        LSB.INR, LSB.LSNTYP1, LSB.LSNINR1, LSB.LSN, LSB.NONREVFLG, LSB.CUR, LSB.AMT, LSB.LSS, LSB.EXPDAT, LSB.LSNINR2, LSB.OWNREF
        from LSB LSB  where
        LSB.ETGEXTKEY = 'CEBGRP'
        and ( LSB.LSN LIKE concat(#{sealsntyp}, '%')
        AND  LSB.AMT>0
        <if test="seaptyinr != null and seaptyinr != ''">
               and  LSB.LSNTYP1 = 'PTY' AND LSB.LSNINR1 = #{seaptyinr}
        </if>
        <if test="seactycod != null and seactycod != ''">
            and  LSB.LSNTYP1 = 'PTY' AND LSB.LSNINR1 = #{seactycod}
        </if>
        <if test="recpanregcod != null and recpanregcod != ''">
        and  LSB.LSNTYP1 = 'PTY' AND LSB.LSNINR1 = #{recpanregcod}
        </if>
        <if test="nonrevflg != null and nonrevflg != ''">
            and  LSB.NONREVFLG = #{nonrevflg}
        </if>
        )
        order by LSB.INR
    </select>
</mapper>